<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var names = ["america","china","austrinia","canada"];
    var count = 0;
    for(var i = 0;i<4;i++){
        if(names[i].indexOf("a")!=-1){
            count++;
        }

    }
    alert(count);
</script>

</body>
</html>